from Tkinter import *
class FinishedGood:
  def __init__(self, master, name, salesprice, demand):
    self.salesPrice = salesprice
    self.demand = demand
    self.qtyShipped = 0
    self.frame = Frame(master, width = 80, height = 40)
    self.frame.pack()
    self.ProductName = Label(self.frame, text=name, bg = "gray", fg = "white")
    self.ProductName.place(relx = 0.3, relwidth = 0.6,
                         relheight = 0.5, rely = 0.25, anchor = CENTER)
    self.Price = Label(self.frame, text="({0})".format(self.salesPrice),
                            bg= "gray", fg="white")
    self.Price.place(relx = 0.8, relwidth = 0.4,
                         relheight = 0.5,rely = 0.25, anchor = CENTER)
    self.Demand = Label(self.frame, text = "{0}".format(self.demand),
                            bg="gray", fg="white")
    self.Demand.place(relx = 0.25, relwidth = 0.5,
                         relheight = 0.5,rely = 0.75, anchor = CENTER)
    self.Shipped = Label(self.frame, text = "0",
                            bg="gray", fg="white")
    self.Shipped.place(relx = 0.75, relwidth = 0.5,
                         relheight = 0.5,rely = 0.75, anchor = CENTER)

  def shipProduct(self, quantity):
    self.qtyShipped += quantity
    self.Shipped.config(text = "{0}".format(self.qtyShipped))
    return quantity*self.salesPrice

  def addDemand(self, quantity):
    self.demand += quantity
    self.Demand.config(text = "{0}".format(self.demand))
